bin: Hide `admin instutil` command
authorColin Walters <walters@verbum.org>
Sat, 7 Apr 2018 15:40:53 +0000 (11:40 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 11 Apr 2018 19:11:07 +0000 (19:11 +0000)
Add a "hidden command" flag, and use it for `admin instutil` since
I regret adding it, and people should be using the API.

Prep for adding another hidden command as part of staging deployments.

(Down the line we should investigate deduplicating the recursive
 command parsing code)

Closes: #1535
Approved by: jlebon

src/ostree/ot-admin-builtin-instutil.c
src/ostree/ot-builtin-admin.c
src/ostree/ot-builtin-remote.c
src/ostree/ot-builtin-static-delta.c
src/ostree/ot-main.c
src/ostree/ot-main.h

index 035bd4f8b6ef4ec53ce2640252718cbb10847d16..fe0d80a4fa66d8de4c4c483238feb60f0546a3fa 100644 (file)
@@ -55,9 +55,12 @@ ostree_admin_instutil_option_context_new_with_commands (void)
 
   while (command->name != NULL)
     {
-      g_string_append_printf (summary, "\n  %-24s", command->name);
-        if (command->description != NULL)
-          g_string_append_printf (summary, "%s", command->description);
+      if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
+        {
+          g_string_append_printf (summary, "\n  %-24s", command->name);
+          if (command->description != NULL)
+            g_string_append_printf (summary, "%s", command->description);
+        }
 
       command++;
     }
index fd6d9a8f92d9fecc60f0af75a1bbea4c37dc1773..1262c5a589a2affb68e11716b3a659730f0480bf 100644 (file)
@@ -45,9 +45,9 @@ static OstreeCommand admin_subcommands[] = {
   { "init-fs", OSTREE_BUILTIN_FLAG_NO_REPO,
      ot_admin_builtin_init_fs,
     "Initialize a root filesystem" },
-  { "instutil", OSTREE_BUILTIN_FLAG_NO_REPO,
+  { "instutil", OSTREE_BUILTIN_FLAG_NO_REPO | OSTREE_BUILTIN_FLAG_HIDDEN,
     ot_admin_builtin_instutil,
-    "Provide instutil commands, allow admin to change boot configuration and relabel selinux " },
+    "Deprecated commands intended for installer programs" },
   { "os-init", OSTREE_BUILTIN_FLAG_NO_REPO,
     ot_admin_builtin_os_init,
     "Initialize empty state for given operating system" },
@@ -85,9 +85,12 @@ ostree_admin_option_context_new_with_commands (void)
 
   while (command->name != NULL)
     {
-      g_string_append_printf (summary, "\n  %-19s", command->name);
-        if (command->description != NULL)
-          g_string_append_printf (summary, "%s", command->description);
+      if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
+        {
+          g_string_append_printf (summary, "\n  %-19s", command->name);
+          if (command->description != NULL)
+            g_string_append_printf (summary, "%s", command->description);
+        }
       command++;
     }
 
index 4deee8c602d95590720c887c273dc554e3750d07..0712d5bfa3a16b7c60f4d6aa7f04a65d097aa826 100644 (file)
@@ -73,10 +73,12 @@ remote_option_context_new_with_commands (void)
 
   while (subcommand->name != NULL)
     {
-      g_string_append_printf (summary, "\n  %-18s", subcommand->name);
-      if (subcommand->description != NULL)
-        g_string_append_printf (summary, "%s", subcommand->description);
-
+      if ((subcommand->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
+        {
+          g_string_append_printf (summary, "\n  %-18s", subcommand->name);
+          if (subcommand->description != NULL)
+            g_string_append_printf (summary, "%s", subcommand->description);
+        }
       subcommand++;
     }
 
index d2a343f2b8e739290872fe266f78fc161c7e40f5..4f9ff2b238922a76704bfc181177a7f3f574810d 100644 (file)
@@ -117,7 +117,8 @@ static_delta_usage (char    **argv,
 
   while (command->name)
     {
-      print_func ("  %-17s%s\n", command->name, command->description ?: "");
+      if ((command->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
+        print_func ("  %-17s%s\n", command->name, command->description ?: "");
       command++;
     }
 
index 654a5f3d6e7275aff86173b9786275a22059c094..237427a27ef5a8b139473691898d87642ee0ae05 100644 (file)
@@ -66,10 +66,13 @@ ostree_option_context_new_with_commands (OstreeCommand *commands)
 
   while (commands->name != NULL)
     {
-      g_string_append_printf (summary, "\n  %-18s", commands->name);
+      if ((commands->flags & OSTREE_BUILTIN_FLAG_HIDDEN) == 0)
+        {
+          g_string_append_printf (summary, "\n  %-18s", commands->name);
 
-      if (commands->description != NULL )
-        g_string_append_printf (summary, "%s", commands->description);
+          if (commands->description != NULL )
+            g_string_append_printf (summary, "%s", commands->description);
+        }
 
       commands++;
     }
index ac75118cafd29c8ef29355ef0621b3eea9c56814..b1b994b6381036eae3d1fbc0965a8074eced5170 100644 (file)
@@ -29,7 +29,8 @@
 typedef enum {
   OSTREE_BUILTIN_FLAG_NONE = 0,
   OSTREE_BUILTIN_FLAG_NO_REPO = 1 << 0,
-  OSTREE_BUILTIN_FLAG_NO_CHECK = 1 << 1
+  OSTREE_BUILTIN_FLAG_NO_CHECK = 1 << 1,
+  OSTREE_BUILTIN_FLAG_HIDDEN = 1 << 2,
 } OstreeBuiltinFlags;
 
 typedef enum {